package com.djp.computerServer.controller;

import com.djp.computerServer.bean.Order;
import com.djp.computerServer.service.OrderService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/order")
public class OrderController extends BaseController<OrderService>{
    @RequestMapping("/add")
    @ResponseBody
    public Map add(@RequestBody Order reqBody) {
        return buildMap("增加订单", service.add(reqBody));
    }

    @RequestMapping("/delete")
    @ResponseBody
    public Map del(@RequestBody Order reqBody) {
        return buildMap("删除订单", service.delete(reqBody));
    }

    @RequestMapping("/update")
    @ResponseBody
    public Map update(@RequestBody Order reqBody) {
        return buildMap("更新订单", service.add(reqBody));
    }

    @RequestMapping("/getAll")
    @ResponseBody
    public Map getAll() {
        return buildMap("获取全部订单", service.getAll());
    }

    @RequestMapping("/getOne")
    @ResponseBody
    public Map getOne(@RequestBody Order reqBody) {
        return buildMap("获取一个订单", service.getOne(reqBody));
    }
}
